package com.srzk.youthleagueback.mapper;

import com.srzk.youthleagueback.pojo.CommuPlat;
import com.srzk.youthleagueback.pojo.Meeting;
import com.srzk.youthleagueback.pojo.Project;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Repository
public interface CommuPlatMapper {
    @InsertProvider(value = CommuPlatProvider.class,method = "insertCommuPlat")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insert(CommuPlat record);

    @Select("SELECT * FROM commu_plat WHERE user = #{user} AND year = #{year}")
    List<CommuPlat> selectByPrimaryKeyList(@Param("user")String user, @Param("year")String year);

    @Select("SELECT * FROM commu_plat WHERE id = #{id} AND user = #{user} AND year = #{year}")
    CommuPlat selectByPrimaryKey(@Param("id")Long id,@Param("user")String user,@Param("year")String year);

    @Select("SELECT * FROM commu_plat WHERE year = #{year}")
    List<CommuPlat> selectByGrade(@Param("year")String year);

    @Select("SELECT * FROM commu_plat WHERE user = #{user}")
    List<CommuPlat> selectAll(@Param("user")String user);

    @UpdateProvider(value = CommuPlatProvider.class,method = "updateCommuPlat")
    int updateByPrimaryKey(CommuPlat record);

    @Delete("DELETE FROM commu_plat WHERE user = #{user} AND year = #{year} AND id = #{id}")
    int deleteByUserAndYearAndTypeAndId(@Param("user")String user,@Param("year")String year,@Param("id")Long id);
}